#include "test_sms.h"
#include "cm_audio_player.h"

static void __playerfile_process_event(cm_audio_play_event_e event)
{
    if (event == CM_AUDIO_PLAY_EVENT_FINISHED)
    {      
        cm_audio_player_stop();
    }
}

static void  test_sms_cb(void)
{
    cm_demo_printf("cm_audio_play_file ret:%d\n",cm_audio_play_file("/Audio/test.mp3", CM_AUDIO_PLAY_FORMAT_MP3, NULL, __playerfile_process_event, "FILEMP3"));
    osDelay(100);
}

void cm_test_sms_operation(unsigned char *cmd[],int len)
{
    if(0==strncmp("SET_SMS_MODE",cmd[2],strlen("SET_SMS_MODE")))
    {
        if(0==strncmp("AT_MODE",cmd[3],strlen("AT_MODE")))
        {
            cm_sms_set_message_mode(CM_SMS_AT_MODE);
            cm_sms_set_user_message_event(NULL);
            cm_demo_printf("cm_sms_set_message_mode no return\n");
        }
        else if(0==strncmp("USER_MODE",cmd[3],strlen("USER_MODE")))
        {
            cm_sms_set_message_mode(CM_SMS_USER_MODE);
            cm_demo_printf("cm_sms_set_message_mode no return\n");
        }
        else{
        cm_demo_printf("param error!\n");
        }
    }
    else if(0==strncmp("SET_SMS_EVENT",cmd[2],strlen("SET_SMS_EVENT")))
    {
        cm_sms_set_user_message_event(test_sms_cb);
        cm_demo_printf("cm_sms_set_user_message_event no return\n");
    }
    else{
        cm_demo_printf("param error!\n");
    }
}